package com.zghhost.codedemo.util;

import java.util.Arrays;

/**
 * @author guohua.zhang@zhaopin.com.cn
 * @Date 2019/5/10 10:11
 */
public class BitUtil {

    /**
     * 补位
     * @param str
     * @param fixChar
     * @param length
     * @return
     */
    public static String prefix(String str,char fixChar,int length){
        char[] strcs = str.toCharArray();

        if(strcs.length >= length){
            return str;
        }

        char[] newcs = new char[length];
        Arrays.fill(newcs,fixChar);

        System.arraycopy(strcs,0,newcs,newcs.length - strcs.length,strcs.length);

        return new String(newcs);
    }
}
